PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/spawnvehicle", true) == 0)
{
new v[256], idx;
v = strtok(cmdtext, idx);
if(!strlen(v)) return SendClientMessage(playerid, 0xFF0000FF, "USE: /spawnvehicle [VEHICLE ID]");
if(!IsValidVehicle(strval(v))) return SendClientMessage(playerid, 0xFF0000FF, "INVALID VEHICLE ID.");
SetVehicleToRespawn(strval(v));
format(v, sizeof v, "Vehicle 60 respawned successfully.", strval(v));
SendClientMessage(playerid, 0xFFFF00FF, v);
return 1;
}
return 0;
}
stock IsValidVehicle(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 406, 407, 408, 409, 413, 414, 416, 418, 423, 424, 427, 428, 431, 434, 437, 442, 443, 444, 445, 455, 456, 457, 459, 471, 482, 483, 485, 486, 489, 490, 494, 495, 498, 499, 500, 502, 503, 504, 505, 508, 514, 524, 525, 528, 530, 531, 543, 544, 545, 556, 557, 568 , 571, 572, 573, 574, 578, 582, 583, 588, 596, 597, 598, 599, 601, 605, 609, 448, 461, 462, 463, 468, 481, 509, 510, 522, 523, 581, 586, 417, 425, 447, 469, 487, 488, 497, 548, 563, 460, 476, 511, 512, 513, 519, 520, 539, 553, 577, 592, 593, 430, 446, 452, 453, 454, 472, 473, 484, 493, 595, 432, 433, 470, 441, 464, 465, 501, 564, 594, 449, 537, 538, 569, 570, 590, 435, 450, 584, 591, 606, 607, 608, 610, 611, 479: return 1;
}
return 0;
}